package views

import (
	"log"
	"net/http"

	"gitee.com/Yu-eng/Myproject/my-go-blog/common"
	"gitee.com/Yu-eng/Myproject/my-go-blog/service"
)

func (*HTMLApi) Index(w http.ResponseWriter, r *http.Request) {
	//页面模板的数据都需要定义,(假数据)
	//实现真实的数据 就需要涉及数据库的查询
	index := common.Template.Index
	hr, err := service.GetAllIndexIndexInfo()
	if err != nil {
		log.Println("Index获取数据出错：", err)
		index.WriteData()
	}
	//这里在common 包下拿全局初始化好的template模板
	index := common.Template.Index
	index.WriteData(w, hr)

}
